<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="common/taglibs.jsp"%>
<%@include file="common/_head.jsp"%>
<html>
<head>
    <link  rel="stylesheet" href="<%=path%>/assets/layuiadmin/layui/css/modules/formSelects/formSelects-v4.css">
</head>
<body>
<div class="layui-form" lay-filter="layuiadmin-form-adminUser" id="layuiadmin-form-adminUser" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">原密码</label>
        <div class="layui-input-block">
            <input type="text" name="oldPwd" id="oldPwd" placeholder="请输入原始密码" class="layui-input" lay-verify="required" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">新密码</label>
        <div class="layui-input-block">
            <input type="text" name="newPwd1" id="newPwd1" placeholder="请输入6-16位新密码" class="layui-input" lay-verify="required|pwd" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">新密码</label>
        <div class="layui-input-block">
            <input type="text" name="newPwd2" id="newPwd2" placeholder="请重新输入6-16位新密码" class="layui-input" lay-verify="required|pwd|newPwd" autocomplete="off">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit="" lay-filter="updPwd-submit" id="updPwd-submit">提交</button>
    </div>
</div>

<script>
    layui.config({
        base: 'assets/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
    }).use(['index', 'form'], function() {
        var $ = layui.$, form = layui.form;

        //校验
        form.verify({
            'pwd': function (value, item) {
                if(value.length < 6 || value.length > 16){
                    return '请输入6-16位新密码';
                }
            },
            'newPwd': function (value, item) {
               var newPwd1 = $('#newPwd1').val();
               var newPwd2 = $('#newPwd2').val();
               if(newPwd1 != newPwd2){
                   return '新密码不一致';
               }
            }
        });
    });
</script>
</body>
</html>
